import java.awt.Color;
import java.awt.event.KeyListener;

/**
 * A GameView is responsible for representing a two person game visually and reporting 
 * player interactions to a GameController. Provides access to visual elements used in
 * Jotto or other Word Mastermind based  games.
 * 
 * @author Sam Snyder
 *
 */
public interface GameView {	
	

	/**
	 * Resets the view to its initial state.
	 */
	void reset();
	
	/**
	 * Registers a listener for user input to Player1's JPassword field.  
	 * 
	 * @param p the player having an listener registered.
	 * @param sal the listener to be added.
	 */
	void addSecretListener(PlayerSelect p, KeyListener sal);
	
	/**
	 * Registers a listener for user input to JTextInput fields.
	 *  
	 * @param gal the listener to be added.
	 */
	void addGuessListener(KeyListener gal);
	
	/**
	 * Sets the specified player's score to the provided number of points. 
	 * 
	 * @param p the player to have their score updated
	 * @param points the number of points it is being set to
	 */
	void setScore(PlayerSelect p, int points);

	/**
	 * Sets the specified player's wins to the provided number.
	 * 
	 * @param p
	 *            the player to have their wins updated.
	 * @param wins
	 *            the number of wins it is being set to
	 */
	void setWins(PlayerSelect p, int wins);

	/**
	 * Allows access a textual element associated with the guessBox. The text and color
	 * may be set through this method.
	 * 
	 * @param text the text to be set
	 * @param c the color to be used on the text
	 */
	void setGuessLabel(String text, Color c);
	
	/**
	 * Displays a message to the user.
	 * 
	 * @param text the message to be displayed.
	 */
	void setUserMessage(String text);
	
	/**
	 * Sets the text of the guessBox. 
	 * 
	 * @param text the text to set the guessBox
	 */
	void setGuessText(String text);
	
	/**
	 * Allows control over the player's ability to edit text in the GuessBox.
	 * 
	 * @param editable if true, not editable if false 
	 */
	void setGuessEditable(boolean editable);

	/**
	 * Reads the text of the guessBox.
	 * @return the text of the guessBox.
	 */
	String getGuessText();
	
	/**
	 * Sets the text of a player's secret word.
	 * 
	 * @param p the player in question.
	 * @param text the text being applied to the player's secret word
	 */
	void setSecretText(PlayerSelect p, String text);
	
	/**
	 * Sets the user's ability to change their secret word.
	 * 
	 * @param p the player in question
	 * @param editable if true, uneditable if false
	 */
	void setSecretEditable(PlayerSelect p, boolean editable);
	
	/**
	 * Retrieves the text entered by the player in a secretWord box.
	 * 
	 * @param p the player in question.
	 * @return the text of the player's secret word.
	 */
	String getSecretText(PlayerSelect p);
	
	/**
	 * Adds a guess to a player's guess history.
	 * 
	 * @param p the player who made the guess.
	 * @param word the word being added to the history
	 * @param matched the number of letters in the guess that match the secret word.
	 */
	void addGuessHistory(PlayerSelect p, String word, int matched);
	
	/**
	 * Clears the guess history for all players.
	 */
	void clearGuessHistories();
}
